package com.starview.star.compiler.cafe.compile.cont;


import org.objectweb.asm.tree.MethodNode;

import com.starview.platform.data.type.Location;
import com.starview.platform.data.type.TypeUtils;
import com.starview.star.compiler.ErrorReport;
import com.starview.star.compiler.cafe.compile.CafeDictionary;
import com.starview.star.compiler.cafe.compile.CodeContext;
import com.starview.star.compiler.cafe.compile.Constructors;
import com.starview.star.compiler.cafe.compile.HWM;
import com.starview.star.compiler.cafe.compile.ISpec;

public class NonNullCont implements IContinuation
{

  @Override
  public ISpec cont(ISpec src, CafeDictionary cxt, Location loc, ErrorReport errors, CodeContext ccxt)
  {
    MethodNode mtd = ccxt.getMtd();
    HWM hwm = ccxt.getMtdHwm();
    if (!TypeUtils.isRawType(src.getType()))
      Constructors.genNullTest(loc, hwm, mtd);
    return src;
  }

  @Override
  public boolean isJump()
  {
    return false;
  }

}
